<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
</head>
<body>
	<textarea id="txt" cols="50" rows="20"></textarea>
	<button onclick="btn()">发布</button>
	<br/>
	<div id="odv" style="width: 400px;height: 200px;border: 1px solid#000;background-color:  #ccc;"></div>

</body>
</html>
<script>
	function btn(){
		var txt = document.getElementById('txt');
		var odv = document.getElementById('odv');
		var arr = [/他妈的/g,/我操/g,/傻叉/g,/吃屎/g];
		var content = txt.value;
		for(var i =0;i<arr.length;i++){
			content = content.replace(arr[i],"*")
		}
		
		odv.innerHTML=content;
	}

	
</script>